from django.urls import path
from rest_framework.routers import SimpleRouter
from .views import StudentViewSet, ClassesViewSet

urlpatterns = [
    # path('student/', StudentViewSet.as_view({'get': 'list', 'post': 'create'})),  # 指定请求方法和对应的操作
    # path('student/<pk>/', StudentViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
]

router = SimpleRouter()  # 实例化路由器
router.register('student', StudentViewSet),  # 注册路由
router.register('classes', ClassesViewSet)
urlpatterns += router.urls  # 获取生成的路由列表
